package cn.tedu._07weibopjt.base.config;

import cn.tedu._07weibopjt.base.interceptors.LoginCheckInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    //    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(new MyInterceptor())
//                .addPathPatterns("/v1/comment/**")
//                .excludePathPatterns("/v1/comment/selectByWeiboId");
//    }
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginCheckInterceptor()).addPathPatterns("/v1/users/currentUser",
                "/v1/weibo/insert","/v1/comment/insert");
    }
}
